package com.test.leetcode;

/**
 * https://leetcode.cn/problems/climbing-stairs/
 * @author sujiafa
 * @date 2025/1/24
 */
public class n70_爬楼梯 {

    public int climbStairs(int n) {
        if (n == 1) {
            return 1;
        }
        if (n == 2) {
            return 2;
        }
        int a = 1;
        int b = 2;
        for (int i = 3; i <= n; i++) {
            int c = a + b;
            a = b;
            b = c;
        }

        return b;
    }
}
